<?php 
class Mcategory extends CI_Model{
    public function __construct(){
        parent::__construct();
        $this->load->database();
    }

    public function getCategoriesByType($type){
        $this->db->select('name, uname, display, page_title, page_description, page_keyword, type');
        $this->db->from('category');
        $this->db->where('category.type', $type);
        $query = $this->db->get();
        return $query -> result_array();
    }

    public function getCategoryByUname($uname){
        $this->db->select('id, name, uname, display, page_title, page_description, page_keyword, type');
        $this->db->from('category');
        $this->db->where('category.uname', $uname);
        $query = $this->db->get();
        return $query -> row_array();
    }
}
?>